function getWeek(dateString) {
    const dateArray = dateString.split('-')
    let date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2])
    const weeks = ['日', '一', '二', '三', '四', '五', '六']
    return weeks[date.getDay()]
}
function getWeekNumber(dateString) {
    const dateArray = dateString.split('-')
    let date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2])
    const weeks = ['7', '1', '2', '3', '4', '5', '6']
    return weeks[date.getDay()]
}
// 已知开始时间和结束时间 计算出中间的所有日期
function getAllDate(start, end) {
    let format = (time) => {
        let ymd = ''
        let year = time.getFullYear()
        let mouth = time.getMonth() + 1
        let day = time.getDate() >= 10 ? time.getDate() : '0' + time.getDate()
        ymd += year + '-' // 获取月份。
        ymd += mouth + '-' // 获取月份。
        ymd += day // 获取日。
        //m.df格式
        return ymd // 返回日期。
    }
    let dateArr = []
    let startArr = start.split('-')
    let endArr = end.split('-')
    let db = new Date()
    db.setUTCFullYear(startArr[0], startArr[1] - 1, startArr[2])
    let de = new Date()
    de.setUTCFullYear(endArr[0], endArr[1] - 1, endArr[2])
    let unixDb = db.getTime()
    let unixDe = de.getTime()
    let stamp
    const oneDay = 24 * 60 * 60 * 1000
    for (stamp = unixDb; stamp <= unixDe; ) {
        dateArr.push(format(new Date(parseInt(stamp))))
        stamp = stamp + oneDay
    }
    return dateArr
}

export default {
    getWeek,
    getWeekNumber,
    getAllDate
}
